/*
============================================================================
 Name        : BlockDragon.h
 Author      : \xD5\x{017c}\xD2\xE7\xE2
 Version     :
 Copyright   : Your copyright notice
 Description : \xC1\x{2EE2FF4}\xC5\xCC
============================================================================
*/

#ifndef BLOCKDRAGON_H
#define BLOCKDRAGON_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "BlockGoods.h"
#include "Field.h"

// CLASS DECLARATION

class TDragonData
{
public:
	TInt m_nSumVol;		//\xD7\xDC\xCA\xFD\xC1\xBF
	TInt64 m_lSumAmt;//\xD7\x{073d}\xF0\xB6\xEE
	TInt64 m_lAmt[4];
	TDragonData()
	{
		m_nSumVol = 0;
		m_lSumAmt = 0;
		for (TInt i =0; i < 4; i++)
			m_lAmt[i] = 0;
	}
};

/**
*  CBlockDragon
* 
*/
class CBlockDragon : public CBlockGoods
{
public:
	~CBlockDragon();

	static CBlockDragon* NewL(CBaseBlock* bsBack);

	static CBlockDragon* NewLC(CBaseBlock* bsBack);

	CBlockDragon(CBaseBlock* bsBack);

private:
	void ConstructL();

public:
	TBool ReadData(const TDesC8& aData);
	void WriteData(TDes8& aBuf);
	TInt GetDataLength();
	TInt16 GetDataType();
	void InitData();
	void OnDraw(CFbsBitGc& g) const;
	void OnKeyDown(TInt keyCode);
	void SizeChanged();
	void OnMouseUp(const TPoint& aPt);
	void ChangeScrollPos(TInt nPos);
	TBool OnMenuEvent(TInt menuId);

private:
	void DrawForm(CFbsBitGc& g, TRect aRect, TInt aLineHeight, CFont* aUseFont) const;
	void DrawPic(CFbsBitGc& g, TRect aRect, CFont* aUseFont) const;
	void DrawText(CFbsBitGc& g, TRect aRect, TInt aLineHeight, TInt aFlag, CFont* aUseFont) const;// 0 buy / 1 sell

protected:
	void AddTabs();

public: // from MTabbarObserver
	void HandleTabbarCommand(TInt aCommand);

private:
	TDragonData m_dBuy;
	TDragonData m_dSell;
	mutable TRect m_part1Rect;
	mutable TRect m_part2Rect;
	mutable TRect m_part3Rect;
	TInt m_nDynamic;
	TRgb m_colorCircle[2][4];

	TBool iRequestOverTimeTip;
	HBufC* 	iStrOverTimeTip;
};

#endif // BLOCKDRAGON_H
